import React, { Component } from "react";
import { Form, Input } from "antd";

class UpdateForm extends Component {
  componentDidMount() {
    let getForm = this.props.getForm;
    let form = this.props.form;
    getForm(form);
  }

  render() {
    let { categoryName = "" } = this.props;
    const { getFieldDecorator } = this.props.form;
    return (
      <Form className="update-form">
        <Form.Item>
          {getFieldDecorator("categoryName", {
            initialValue: categoryName,
            rules: [{ required: true, message: "分类名称必须输入" }],
          })(<Input placeholder="请输入名称" />)}
        </Form.Item>
      </Form>
    );
  }
}

export default Form.create()(UpdateForm);
